<template>
	<view class="pop" :class="{'active':modalShow}">
		<view class="modal_box">
			<view class="title">
				提醒
			</view>
			<view class="body flex_c">
				<view>{{content||''}}</view>
			</view>
			<view class="footer flex_sb">
				<view class="btn gray" @click="modalShow=false" v-if="showCancel">
					取消
				</view>
				<view class="btn" @click="confirm">
					确认
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			content: {
				type: String,
				default: '是否确认提交?'
			},
			showCancel: {
				type: Boolean,
				default: true
			}
		},
		name: "modal",
		data() {
			return {
				modalShow: false,
			};
		},
		methods: {
			confirm() {
				this.modalShow = false
				this.$emit('confirm')
			},
			open() {
				this.modalShow=true
			}
		}

	}
</script>

<style lang="scss" scoped>
	.pop{
		position: fixed;
		top: 0;
		left: 0;
		width: 100vw;
		height: 100vh;
		background: rgba(0, 0, 0, 0.3);
		display: flex;
		transition: all .2s linear;
		opacity: 0;
		z-index: -1;
	}
	.active{
		opacity: 1;
		z-index: 10;
	}
	.modal_box {
		width: 540rpx;
		// height: 482rpx;
		border-radius: 33rpx;
		background: #FFFFFF;
		overflow: hidden;
		font-size: 28rpx;
		font-weight: 500;
		color: #3D3D3D;
		text-align: center;
		margin: auto;
		.title {
			height: 100rpx;
			font-size: 32rpx;
			padding-top: 57rpx;

			height: 100rpx;
		}

		.body {
			height: 150rpx;
			line-height: 50rpx;
			padding-bottom: 25rpx;
		}

		.footer {
			width: 100%;
			height: 100rpx;
			line-height: 100rpx;
			border-top: 2rpx solid #F2F2F2;

			.btn {
				height: 100%;
				// width: 50%;
				flex-grow: 1;
				font-size: 28rpx;
				font-weight: 500;

				&:nth-child(1) {
					border-right: 1px solid #F2F2F2;
				}

				&:nth-child(2) {
					border-left: 1px solid #F2F2F2;
				}
			}

			.gray {
				color: #999999;
			}
		}
	}
</style>